package com.my_library_one.mybase;

import android.app.Application;
import android.content.Context;
import com.my_library_one.util.SpUtil;
import com.zhy.http.okhttp.OkHttpUtils;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;

/**
 *
 */
public class MyApplication extends Application {

    public SpUtil sputil;
    public static boolean ignoreMobile;

    @Override
    public void onCreate() {
        super.onCreate();
        application = this;
        sputil = SpUtil.init(this,SpUtil.USER_LOGIN_INFO, Context.MODE_PRIVATE);

        OkHttpClient okHttpClient = OkHttpUtils.getInstance().getOkHttpClient().newBuilder()
                .connectTimeout(20000, TimeUnit.MILLISECONDS)
                .readTimeout(20000, TimeUnit.MILLISECONDS).build();
        OkHttpUtils.initClient(okHttpClient);
    }

    /**
     * 单例模式
     */
    private static MyApplication application;

    public static MyApplication getInstance() {
        return application;
    }

}
